def writeFile():
    f=open("d:\\azmt.txt","wt")
    f.write("xba\nxyz")
    f.close()
def readFile():
    f=open("d:\\azmt.txt","rt")     #用只读方式打开D盘下的xba文本文档，并赋予变量f
    for x in f.readlines():
        print(x,end="")
    f.close()


try:
    writeFile()
    readFile()
except Ellipsis as err:
    print(err)